<?php

class DataBackupController extends Controller {
    var $name = 'DataBackup';
    var $components = array('database');

    function index() {
        $this->action = 'data_backup';
        $this->data_backup();
    }

    function data_backup() {
        if (!empty($this->data)) {
            if ($this->data['Backup']['action'] != 'store_file') {
                $this->layout = null;
            }
            $database = new AcpDatabase;
            $status = $database->backup($this->data['Backup']['action'], $this->data['Backup']['file_type']);
            $this->header_notice = __($status);
        } else {
            $this->data['Backup']['file_type'] = 'gzip';
            $this->data['Backup']['action'] = 'download';
        }
    }
}

?>
